package com.example.spingioc.component;

import com.example.spingioc.model.UserInfo;
import com.example.spingioc.repository.UserRepository;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

@Component
public class UserInfoComponent {
    @Bean
    public UserInfo userInfo(){
        return new UserInfo("zhangsan",12);
    }

//    @Primary
    @Bean
    public UserInfo userInfo1(){
        return new UserInfo("lisi",15);
    }

    @Bean
    public UserInfo userInfo2(){
        return new UserInfo("wangwu",15);
    }

    @Bean
    public UserInfo userInfo3(){
        return new UserInfo("zhaoliu",17);
    }

    @Bean
    public String name(){
        return "test";
    }

//    @Primary
    @Bean
    public String name2(){
        return "test2";
    }


    @Bean
    public UserInfo userInfo4(@Qualifier("name") String name3){
        return new UserInfo(name3,18);
    }
}
